<?php if (!defined('THINK_PATH')) exit(); /*a:1:{s:76:"/www/wwwroot/mamingwang.cn/yzf/application/index/view/register/resigter.html";i:1557018222;}*/ ?>
<!DOCTYPE html>
<html>
<head>
	<title>注册</title>
	<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
	<script>
        window.onload = function(){
            getRem(720,100)
        };
        window.onresize = function(){
            getRem(720,100)
        };
        function getRem(pwidth,prem){
            var html = document.getElementsByTagName("html")[0];
            var oWidth = document.body.clientWidth || document.documentElement.clientWidth;
            html.style.fontSize = oWidth/pwidth*prem + "px";
        }
    </script>
	<style type="text/css">
		*{margin: 0;padding: 0;}
		.flex{
			display: -webkit-box;
    			display: -webkit-flex;
    			display: -ms-flexbox;
    			display: flex;
		}
		.blue-bg{
			width: 100%;
			height: 6rem;
			background:  url("http://mamingwang.cn/public/static/images/login_bg.png") no-repeat;
			background-size: 100% 100%;
			background-position: 100% 100%;
		}
		.content-form{
			width: 6rem;
    			height: 8rem;
    			background-color: #ffffff;
    			border-radius: 0.5rem;
    			position: absolute;
    			top: 2rem;
    			left: 50%;
    			margin-left: -3rem;
    			box-shadow: 0px 10px 40px 0px rgba(223, 223, 223, 0.91);
		}
		.content-form-main{
			margin-top: 1rem;
		}
		.content-form-list{
			height: 0.6rem;
			border-bottom: 1px solid #eeeeee;
			align-items: center;
			margin-bottom:  0.35rem;
		}
		.content-form-list img{
			width: 0.4rem;
    			height: 0.5rem;
    			padding: 0 0.28rem;
		}
		.content-form-list input{
			width: 60%;
			background-color: #ffffff;
			border: none;
			height: 80%;
		}
		.content-form-list-code{
			color: #000000;
			font-size: 0.2rem;
			margin-left: 0.3rem;
		}
		.content-form-button{
			width: 2rem;
    			height: 0.6rem;
    			background-color: #4877F2;
    			line-height: 0.6rem;
    			text-align: center;
    			font-size: 13px;
    			color: #ffffff;
    			margin: 0 auto;
    			border-radius: 0.5rem;
    			margin-top: 0.5rem
		}
		.content-form-logo{
			width: 1.5rem;
    			height: 1.5rem;
    			overflow: hidden;
    			border-radius: 50%;
    			position: absolute;
    			top: -0.7rem;
    			left: 50%;
    			margin-left: -0.75rem;
		}
		.content-form-logo img{
			width: 100%;
			height: 100%;
		}
		.none{
			display: none;
		}
	</style>
	<link rel="stylesheet" href="/public/static/css/style.css">
</head>
<body>
	<div class="content">
		<!-- 蓝色背景 -->
		<div class="blue-bg"></div>
		<!-- 提交内容 -->
		<div class="content-form">
			<div class="content-form-logo">
				<img src="/public/static/images/logo.png">
			</div>
			<div class="content-form-main">
				<div class="content-form-list flex">
					<img src="/public/static/images/mine_select.png">
					<input id="yy" type="text" name="username" placeholder="请输入用户名">
				</div>
				<div class="content-form-list flex">
					<img src="/public/static/images/login_phone.png">
					<input id="phone" type="text" name="phone" placeholder="请输入手机号">
				</div>
				<div class="content-form-list flex">
					<img src="/public/static/images/login_code.png">
					<input type="text" id="sms_code" name="sms_code" placeholder="请输入验证码" style="width:48%;">
					<div id="sendCode" class="content-form-list-code" onclick="sms()">发送验证码</div>
					<div id="sendCodeT" class="content-form-list-code none">发送验证码</div>
				</div>
				<div class="content-form-list flex">
					<img src="/public/static/images/login_suo.png">
					<input type="password" id="password" name="password" placeholder="请输入密码">
				</div>
				<div class="content-form-list flex">
					<img src="/public/static/images/login_suo.png">
					<input type="password" id="password1" name="password1" placeholder="请输入确认密码">
				</div>
				<div class="content-form-list flex">
					<img src="/public/static/images/login_invite.png">
					<input type="text" id="yqm" name="yqm" placeholder="请输入邀请码">
				</div>
			</div>
			<div class="content-form-button" id="sub">注册</div>
		</div>
	</div>
<script type="text/javascript" src="/public/static/js/popups.js"></script>
<script type="text/javascript" src="/public/static/js/jquery-3.3.1.min.js"></script>
<script type="text/javascript">

    var url= window.location.href;
    var index = url.substring(url.lastIndexOf('=') + 1);
    //alert(index);
    $(document).ready(function(){
        //alert(index);
            $('#yqm').val(index);
        });
    $(function(){
        $('#sub').click(function(){
            //console.log(44);
			if($('#yy').val() == '') {
                jqalert({
                    title: '提示',
                    content: '请填写用户名',
                })
            }
			else if($("#phone").val() == '')
			{
				jqalert({
					title:'提示',
					content:'请填写手机号',
				})
			}
			else if($("#sms_code").val() == '')
			{
				jqalert({
					title:'提示',
					content:'请填写验证码',
				})
			}
			else if($("#password").val() == '')
			{
				jqalert({
					title:'提示',
					content:'请填写密码',
				})
			}
			else if($("#password2").val() == '')
			{
				jqalert({
					title:'提示',
					content:'请再次填写密码',
				})
			}
			else if($("#yqm").val() == '')
			{
				jqalert({
					title:'提示',
					content:'请填写邀请码',
				})
			}
			else {
                $.ajax({
                    type: "POST",
                    url: "<?php echo url('index/Register/register'); ?>",
                    data: {username: $("#yy").val(), phone: $("#phone").val(),sms_code:$('#sms_code').val(),password:$("#password").val(),password1:$("#password1").val(),yqm:$("#yqm").val()},
                    dataType: "json",
                    success: function (data) {
                        jqalert({
                            title: '提示',
                            content: data.msg,
                        })
                    },
                    error: function (data) {
                        jqalert({
                            title: '提示',
                            content: data.msg,
                        })
                    }
                });
            }
        });
    });
	function sms() {
        //SendSms
        $.ajax({
            type: "POST",
            url: "<?php echo url('api/Sms/SendSms'); ?>",
            data: {tel: $("#phone").val()},
            dataType: "json",
            success: function (data) {
                jqalert({
                    title: '提示',
                    content: '发送成功，注意查收',
                })
            },
            error: function (data) {
                var aa=document.getElementById('phone').value;
                //alert(aa);
                if(aa.length==11)
                {
                    $('#sendCode').addClass('none');
                    $('#sendCodeT').removeClass('none');
                    var time = 61;
                    var identifyingCode = '';
                    var interval = setInterval(function() {
                        time--;
                        identifyingCode = time + '秒后重新发送';
                        $('.content-form-list-code').html(identifyingCode);
                        if (time == 0) {
                            clearInterval(interval)
                            $('#sendCodeT').addClass('none');
                            $('#sendCode').removeClass('none');
                            $('.content-form-list-code').html('重新发送');
                        }
                    }, 1000);
                    jqalert({
                        title:'提示',
                        content:'发送成功，注意查收',
                    })
					return false;
                }
                else
				{
                    jqalert({
                        title: '提示',
                        content: '请输入正确的手机号',
                    })
				}

            }
        });


    }

</script>
</body>
</html>